package ai.connectfour;

import ai.connectfour.algorithm.IterativeDeepening;
import ai.connectfour.entities.Action;
import ai.connectfour.entities.Player;
import ai.connectfour.entities.State;

public class Controller {
	IterativeDeepening algorithm;
	
	public Controller(IterativeDeepening algorithm){
		this.algorithm = algorithm;
	}
	
	public void doComputerTurn(){
		try {
			Action decisionAction = algorithm.makeDecision(); 
			algorithm.doTurn(decisionAction);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void doPlayerTurn(int col) {
		algorithm.doTurn(new Action(col, Player.MIN));
		doComputerTurn();
	}

	public void resetGame() {
		algorithm.setCurrentGameState(new State());
	}

	public void undoPlayerTurn(int col) {
	}
}
